package es.ikex.servlet;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import es.ikex.dao.ProductosDAO;


public class EditarBorrar extends HttpServlet {
	private static final long serialVersionUID = 1L;

	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		String descatalogar = "";
		if(request.getParameter("editar")!= null){
			request.getRequestDispatcher("Controlador/procesarEleccion.jsp?dest=editarProducto").forward(request, response);
		}else if(request.getParameter("descatalogar")!= null){
			descatalogar = "S";
			
		}else if(request.getParameter("catalogar")!= null){
			descatalogar = "N";
		}
		
		if(!descatalogar.equals("")){
			ProductosDAO pd = new ProductosDAO();
			String producto = request.getParameter("codigo");
			pd.descatalogarProducto(producto, descatalogar);
			request.getRequestDispatcher("Admin/modificacionOk.jsp").forward(request, response);
		}
	}

}
